package org.yray.sip.config.forecast;

import io.netty.util.HashedWheelTimer;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.yray.sip.rtp.sender.ISipSessionCache;
import org.yray.sip.rtp.sender.SipSessionCache;
import org.yray.sip.time.SendPacketTimer;

@Configuration
@EnableConfigurationProperties({SystemProperties.class})
public class ConfForecast {

    private SystemProperties properties;

    public ConfForecast(SystemProperties properties) {
        this.properties = properties;
    }


    @Bean
    public ISipSessionCache sipSessionCache()
    {
        ISipSessionCache sipSessionCache=new SipSessionCache(properties);
        return sipSessionCache;
    }


    @Bean
    public SendPacketTimer sendPacketTimer()
    {
        SendPacketTimer sendPacketTimer=new SendPacketTimer();
        Thread thread=new Thread(sendPacketTimer,"Media-SendPacketTimer");
        thread.start();
        return sendPacketTimer;
    }


    @Bean
    public HashedWheelTimer hashedWheelTimer()
    {
        return new HashedWheelTimer();
    }


}
